package com.ilink.groundservice.mapper.study.course;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ilink.ilinkcommon.domain.PO.studyservice.StudyFileSource;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface FileContentMapper extends BaseMapper<StudyFileSource> {

    // 查询：根据filesource_id查询introduction, translation, mindmap字段
    @Select("SELECT introduction, translation, mindmap FROM study_filesource WHERE filesource_id = #{filesource_id} LIMIT 1")
    public StudyFileSource.FileContentDTO  selectIntroductionTranslationMindmapByFileSourceId(Long filesource_id);

    // 更新：根据file_id更新introduction, mindmap, tongyi_id字段
    @Update("UPDATE study_filesource SET introduction = #{introduction}, mindmap = #{mindmap}, tongyi_id = #{tongyiId} WHERE filesource_id = #{filesourceId}")
    public boolean updateFileContent(String introduction, String mindmap, String tongyiId, Long filesourceId);
}
